/*
 * This file (AkSquare.java) is protected by the GNU GPL licence (v2). 
 * Please read the license.txt attached for further informations. 
 * 
 */

package alkwarel.shapes;

import alkwarel.objects.AkArtspace;
import alkwarel.objects.AkShape;
import artx.utils.AxLog;
import artx.utils.AxRandom;

/**
 * Draws a rectangle.
 * 
 * @author Xavier Gouchet
 * 
 */
public class AkRectangle extends AkShape {

	/**
	 * Standard Constructor.
	 */
	public AkRectangle() {
		super(2, "Rectangle",null);
	}

	/**
	 * @see alkwarel.objects.AkShape#Draw(alkwarel.objects.AkArtspace)
	 */
	public boolean Draw(AkArtspace a) {
		AxLog.Debug("AkSquare::Draw =>> applying a Square on an artspace");
		// TopLeft corner, width, height
		float t,l,r,d;
		t = AxRandom.RandF(a.height);
		d = AxRandom.RandF(t+1, a.height);
		l = AxRandom.RandF(a.width);
		r = AxRandom.RandF(l+1, a.width);
		AxLog.Debug("AkRectangle::Draw =>> Drawing rectangle "+t+";"+l+";"+d+";"+r);
		a.DrawStroke(t, l, t, r);
		a.DrawStroke(t, r, d, r);
		a.DrawStroke(d, r, d, l);
		a.DrawStroke(d, l, t, l);
		return true;
	}

}
